﻿using System;
using DapperExtensions.Mapper;
using Newtonsoft.Json;
using ZilLion.Service.Core.Domain.EntityBase.JsonConverter;

namespace ZL.CRM.CommonEntity.AccYwDetail
{
    public class Cfv4Accopr2 : OprYwCommon
    {
        /// <summary>
        /// 卡种id
        /// </summary>
        public int Oprcgsid { get; set; }

        /// <summary>
        ///  消费生成方式：0-正常消费 3-积分兑换 4-过期红包回收 5-撤销送积分 6-余额调减 7-积分调减
        /// </summary>
        public short Oprtype { get; set; }


        /// <summary>
        ///  操作记录：发生品牌id
        /// </summary>
        public int Oprppid { get; set; }

        /// <summary>
        ///  操作记录：发生品牌名称
        /// </summary>
        public string Oprppname { get; set; }

        /// <summary>
        ///  操作记录：减少现金钱包（所有钱包）
        /// </summary>
        public decimal Oprxfxj { get; set; }

        /// <summary>
        ///  操作记录：减少增值钱包（不含红包）
        /// </summary>
        public decimal Oprxfzz { get; set; }

        /// <summary>
        ///  操作记录：减少红包
        /// </summary>
        public decimal Oprxfhb { get; set; }

        /// <summary>
        ///  操作记录：减少积分
        /// </summary>
        public decimal Oprxfjf { get; set; }

        /// <summary>
        ///  操作记录：变动后现金钱包
        /// </summary>
        public decimal Opraftxj { get; set; }

        /// <summary>
        ///  操作记录：变动后充值增值钱包(不含红包)
        /// </summary>
        public decimal Opraftzz { get; set; }

        /// <summary>
        ///  操作记录：变动后积分(可兑+不可兑)
        /// </summary>
        public int Opraftjf { get; set; }


        /// <summary>
        ///  事件关联：0-不积分不兑换 1-积分充值 2-积分兑换
        /// </summary>
        public short Oprjfsign { get; set; }


        public decimal Oprxfsum => Oprxfxj + Oprxfzz + Oprxfhb;

        public decimal OprAftsum => Opraftxj + Opraftzz;

    }
    public class Cfv4Accopr2Mapper : ClassMapper<Cfv4Accopr2>
    {
        public Cfv4Accopr2Mapper()
        {
            Table("#Cfv4Accopr2");
            Map(f => f.Oprtime).Column("Oprtime");
            Map(f => f.Oprsno).Column("Oprsno");
            Map(f => f.Opraccid).Column("Opraccid");
            Map(f => f.Oprcardno).Column("Oprcardno");
            Map(f => f.Oprctype).Column("Oprctype");
            Map(f => f.Oprcgsid).Column("Oprcgsid");
            Map(f => f.Oprtype).Column("Oprtype");
            Map(f => f.Oprbrid).Column("Oprbrid");
            Map(f => f.Oprbrname).Column("Oprbrname");
            Map(f => f.Oprppid).Column("Oprppid");
            Map(f => f.Oprppname).Column("Oprppname");
            Map(f => f.Oprid).Column("Oprid");
            Map(f => f.Oprname).Column("Oprname");
            Map(f => f.Oprxfxj).Column("Oprxfxj");
            Map(f => f.Oprxfzz).Column("Oprxfzz");
            Map(f => f.Oprxfhb).Column("Oprxfhb");
            Map(f => f.Oprxfjf).Column("Oprxfjf");
            Map(f => f.Opraftxj).Column("Opraftxj");
            Map(f => f.Opraftzz).Column("Opraftzz");
            Map(f => f.Opraftjf).Column("Opraftjf");
            Map(f => f.Oprywsno).Column("Oprywsno");
            Map(f => f.Oprywdate).Column("Oprywdate");
            Map(f => f.Oprjfsign).Column("Oprjfsign");
            Map(f => f.Oprskbrid).Column("Oprskbrid");
            Map(f => f.Oprskbrname).Column("Oprskbrname");
            Map(f => f.Oprskppid).Column("Oprskppid");
            Map(f => f.Oprskppname).Column("Oprskppname");
            Map(f => f.Oprywwindow).Column("Oprywwindow");
            Map(f => f.Oprywbno).Column("Oprywbno");
            Map(f => f.Oprsummary).Column("Oprsummary");
            Map(f => f.Appidopenid).Column("Appidopenid");
        }

    }
}